package com.d0326;

import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class TestHashSet {
    public static void main(String[] args) {
        Set<Student> set=new HashSet<>();
        Student stu1= new Student("zhangsna",12,44);
        Student stu2= new Student("lisi",22,54);
        Student stu3= new Student("zhangsna",12,44);
        set.add(stu1);
        set.add(stu2);
        set.add(stu3);
        //System.out.println("元素个数"+set.size());
        /*Iterator<Student> iterator=set.iterator();
        while (iterator.hasNext()){
            Student student=iterator.next();
            System.out.println(student);
        }*/

        set.forEach(student -> System.out.println(student));

    }
}
